package com.ws.genercity.demo10;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.DoubleSummaryStatistics;

/**
 * @author 13353
 * 泛型与数组的介绍
 */
public class Test11 {
    public static void main(String[] args) {
        //ArrayList[] list = new ArrayList[5];
        //ArrayList<String>[] listArray = list;
        ArrayList<String>[] list = new ArrayList[5];

        //有弊端
        ArrayList<String> strings = new ArrayList<>();
        strings.add("100");
        list[0] = strings;
        //list[0] = integers;
        //String s = listArray[0].get(0);
        System.out.println(list[0].get(0));
        System.out.println("========================");

        Fruit<String> fruit = new Fruit<>(String.class,5);
        fruit.put(0,"hello");
        fruit.put(1,"world");
        fruit.put(2,"java");
        for (String s : fruit.getArray()) {
            //没有索引的为null
            System.out.println(s);
        }
        System.out.println(Arrays.toString(fruit.getArray()));


































    }
}
